package homework.work3;

public class Student implements Cloneable{
    int age;
    String name;
    Star s;

    //深克隆
    @Override
    public Student clone() throws CloneNotSupportedException {
        Student cloneStudent = (Student)super.clone();
        if(cloneStudent.s!=null){
            Star cloneStar =(Star) cloneStudent.s.clone();
            cloneStudent.s=cloneStar;
        }
        return cloneStudent;
    }

    //构造器
    public Student() {
    }
    public Student(int age, String name, Star s) {
        this.age = age;
        this.name = name;
        this.s = s;
    }
}
